//
//  KZMessageEmptyView.swift
//  BoyeStore
//
//  Created by 朱凯 on 2018/6/28.
//  Copyright © 2018年 itboye. All rights reserved.
//

import UIKit

class KZMessageEmptyView: UIView {
    
    let image: UIImage
    let text: String

    init(frame: CGRect, image: UIImage, text: String) {
        self.image = image
        self.text = text
        super.init(frame: frame)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
extension KZMessageEmptyView {
    
    func setupUI() {
        
        let imageView = UIImageView()
        imageView.image = image
        self.addSubview(imageView)
        imageView.snp.makeConstraints { (m) in
            m.centerX.equalTo(self)
            m.bottom.equalTo(self.snp.centerY)
        }
        
        let label = UILabel()
        label.adjustsFontSizeToFitWidth = true
        label.numberOfLines = 1
        label.textColor = UIColor.lightGray
        label.textAlignment = .center
        label.text = text
        label.font = UIFont.systemFont(ofSize: 14)
        self.addSubview(label)
        label.snp.makeConstraints { (m) in
            m.left.right.equalTo(0)
            m.top.equalTo(imageView.snp.bottom).offset(20)
        }
    }
}
